package net.ncdesign.components.nodeWorkspace.core.base
{
	import flash.display.Graphics;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	
	import mx.containers.Canvas;

	[Event(name="deleteLink", type="flash.events.Event")]
	public class LinkControlPoint extends Canvas
	{
		public  var linkName:String = '';
		public function LinkControlPoint(center:Point, linkName:String, color:uint)
		{
			super();
			this.linkName = linkName
			this.x = center.x;
			this.y = center.y;
			this.width = 8;
			this.height = 8;
			var g:Graphics = this.graphics;
			g.beginFill(color, 1);
			g.drawCircle(4, 4, 4);
			g.endFill();
			this.addEventListener(MouseEvent.CLICK, onMouseClick);
		}
		
		private function onMouseClick(event:MouseEvent):void
		{
			var eventObj:Event = new Event('deleteLink');
			dispatchEvent(eventObj);
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			x = x-4;
			y = y-4;
		}
		
	}
}